package ar.edu.itba.it.paw.web.component;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

import ar.edu.itba.it.paw.domain.Product;

public class PriceLabel extends Label{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public PriceLabel(String id, IModel<Double> model) {
		super(id, new UnitModel(model));
	}
	private static class UnitModel implements IModel<String>{

		IModel<Double> model;

		UnitModel(IModel<Double> model){
			this.model = model;
		}

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public void detach() {
			model.detach();
		}

		@Override
		public String getObject() {
			return "$" + String.valueOf(model.getObject());
		}

		@Override
		public void setObject(String object) {
			// TODO Auto-generated method stub

		}
	}
}
